package com.huaweicloud.sdk.secmaster.v1.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.time.OffsetDateTime;
import java.util.Objects;

/**
 * VulnerabilityPatch
 */
public class VulnerabilityPatch {

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "patch_id")

    private String patchId;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "patch_name")

    private String patchName;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "type")

    private String type;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "major_level")

    private String majorLevel;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "status")

    private String status;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "repair_cmd")

    private String repairCmd;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "repair_necessity")

    private String repairNecessity;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "release_time")

    private OffsetDateTime releaseTime;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "reference_url")

    private String referenceUrl;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "vendor_name")

    private String vendorName;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "vulnerable_package")

    private String vulnerablePackage;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "cve_ids")

    private String cveIds;

    public VulnerabilityPatch withPatchId(String patchId) {
        this.patchId = patchId;
        return this;
    }

    /**
     * 补丁编号。
     * @return patchId
     */
    public String getPatchId() {
        return patchId;
    }

    public void setPatchId(String patchId) {
        this.patchId = patchId;
    }

    public VulnerabilityPatch withPatchName(String patchName) {
        this.patchName = patchName;
        return this;
    }

    /**
     * 补丁名称。
     * @return patchName
     */
    public String getPatchName() {
        return patchName;
    }

    public void setPatchName(String patchName) {
        this.patchName = patchName;
    }

    public VulnerabilityPatch withType(String type) {
        this.type = type;
        return this;
    }

    /**
     * 补丁类型（0：linux，1：windows，2：web-cms）。
     * @return type
     */
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public VulnerabilityPatch withMajorLevel(String majorLevel) {
        this.majorLevel = majorLevel;
        return this;
    }

    /**
     * 重要等级。
     * @return majorLevel
     */
    public String getMajorLevel() {
        return majorLevel;
    }

    public void setMajorLevel(String majorLevel) {
        this.majorLevel = majorLevel;
    }

    public VulnerabilityPatch withStatus(String status) {
        this.status = status;
        return this;
    }

    /**
     * 补丁状态。
     * @return status
     */
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public VulnerabilityPatch withRepairCmd(String repairCmd) {
        this.repairCmd = repairCmd;
        return this;
    }

    /**
     * 修复命令。
     * @return repairCmd
     */
    public String getRepairCmd() {
        return repairCmd;
    }

    public void setRepairCmd(String repairCmd) {
        this.repairCmd = repairCmd;
    }

    public VulnerabilityPatch withRepairNecessity(String repairNecessity) {
        this.repairNecessity = repairNecessity;
        return this;
    }

    /**
     * 修复必要程度（1：需立刻修复，2：可延后修复，3：暂可以不修复）。
     * @return repairNecessity
     */
    public String getRepairNecessity() {
        return repairNecessity;
    }

    public void setRepairNecessity(String repairNecessity) {
        this.repairNecessity = repairNecessity;
    }

    public VulnerabilityPatch withReleaseTime(OffsetDateTime releaseTime) {
        this.releaseTime = releaseTime;
        return this;
    }

    /**
     * 发布时间，格式ISO8601：YYYY-MM-DDTHH:mm:ss.ms+timezone。时区信息       为事件发生时区，无法解析时区的时间，默认时区填东八区。
     * @return releaseTime
     */
    public OffsetDateTime getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(OffsetDateTime releaseTime) {
        this.releaseTime = releaseTime;
    }

    public VulnerabilityPatch withReferenceUrl(String referenceUrl) {
        this.referenceUrl = referenceUrl;
        return this;
    }

    /**
     * 参考链接。
     * @return referenceUrl
     */
    public String getReferenceUrl() {
        return referenceUrl;
    }

    public void setReferenceUrl(String referenceUrl) {
        this.referenceUrl = referenceUrl;
    }

    public VulnerabilityPatch withVendorName(String vendorName) {
        this.vendorName = vendorName;
        return this;
    }

    /**
     * 漏洞报告提供者信息。
     * @return vendorName
     */
    public String getVendorName() {
        return vendorName;
    }

    public void setVendorName(String vendorName) {
        this.vendorName = vendorName;
    }

    public VulnerabilityPatch withVulnerablePackage(String vulnerablePackage) {
        this.vulnerablePackage = vulnerablePackage;
        return this;
    }

    /**
     * 受影响软件版本。
     * @return vulnerablePackage
     */
    public String getVulnerablePackage() {
        return vulnerablePackage;
    }

    public void setVulnerablePackage(String vulnerablePackage) {
        this.vulnerablePackage = vulnerablePackage;
    }

    public VulnerabilityPatch withCveIds(String cveIds) {
        this.cveIds = cveIds;
        return this;
    }

    /**
     * CVE编号列表。
     * @return cveIds
     */
    public String getCveIds() {
        return cveIds;
    }

    public void setCveIds(String cveIds) {
        this.cveIds = cveIds;
    }

    @Override
    public boolean equals(java.lang.Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        VulnerabilityPatch that = (VulnerabilityPatch) obj;
        return Objects.equals(this.patchId, that.patchId) && Objects.equals(this.patchName, that.patchName)
            && Objects.equals(this.type, that.type) && Objects.equals(this.majorLevel, that.majorLevel)
            && Objects.equals(this.status, that.status) && Objects.equals(this.repairCmd, that.repairCmd)
            && Objects.equals(this.repairNecessity, that.repairNecessity)
            && Objects.equals(this.releaseTime, that.releaseTime)
            && Objects.equals(this.referenceUrl, that.referenceUrl) && Objects.equals(this.vendorName, that.vendorName)
            && Objects.equals(this.vulnerablePackage, that.vulnerablePackage)
            && Objects.equals(this.cveIds, that.cveIds);
    }

    @Override
    public int hashCode() {
        return Objects.hash(patchId,
            patchName,
            type,
            majorLevel,
            status,
            repairCmd,
            repairNecessity,
            releaseTime,
            referenceUrl,
            vendorName,
            vulnerablePackage,
            cveIds);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class VulnerabilityPatch {\n");
        sb.append("    patchId: ").append(toIndentedString(patchId)).append("\n");
        sb.append("    patchName: ").append(toIndentedString(patchName)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    majorLevel: ").append(toIndentedString(majorLevel)).append("\n");
        sb.append("    status: ").append(toIndentedString(status)).append("\n");
        sb.append("    repairCmd: ").append(toIndentedString(repairCmd)).append("\n");
        sb.append("    repairNecessity: ").append(toIndentedString(repairNecessity)).append("\n");
        sb.append("    releaseTime: ").append(toIndentedString(releaseTime)).append("\n");
        sb.append("    referenceUrl: ").append(toIndentedString(referenceUrl)).append("\n");
        sb.append("    vendorName: ").append(toIndentedString(vendorName)).append("\n");
        sb.append("    vulnerablePackage: ").append(toIndentedString(vulnerablePackage)).append("\n");
        sb.append("    cveIds: ").append(toIndentedString(cveIds)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }

}
